home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / OpenDoc / OpenDoc Utilities / Interfaces / SEUtils.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-01  |  3.4 KB  |  134 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        SEUtils.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Jon Pugh
  7.  
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <5>      12/13/96    JP        1611571: Renamed parameter
  13.          <4>     9/26/96    JP        1372897: Added CompareDescs utility.
  14.          <3>     9/24/96    TJ        Added Includes
  15.          <2>     9/23/96    JP        1384958: Moved routines from SEPriv.h,
  16.                                     renamed GetDefaultRootFrame & added
  17.                                     ShouldHandleEvent
  18.  
  19.     To Do:
  20. */
  21.  
  22. /*
  23.     File:        SEUtils.h
  24.  
  25.     Contains:    Interface to Semantic Events Utility Functions
  26.  
  27.     Owned by:    Nick Pilch
  28.  
  29.     Copyright:    © 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  30.  
  31.     
  32.     In Progress:
  33.         
  34. */
  35.  
  36. #ifndef _SEUTILS_
  37. #define _SEUTILS_
  38.  
  39. #ifndef _ODTYPES_
  40. #include "ODTypes.h"
  41. #endif
  42.  
  43. #ifndef SOM_ODPart_xh
  44. #include "Part.xh"
  45. #endif
  46.  
  47. #ifndef SOM_ODSession_xh
  48. #include <ODSessn.xh>
  49. #endif
  50.  
  51. // the type should determine how many bytes are moved....
  52.  
  53. class ODAppleEvent;
  54. class ODNameResolver;
  55. class ODOSLToken;
  56.  
  57. #define SETBYTESOFHANDLE(h,typ,data,skipbytes)                            \
  58.     *((typ*)((*(h))+(skipbytes))) = (data)                                \
  59.  
  60. #define GETBYTESOFHANDLE(h,typ,skipbytes)                                \
  61.     *((typ*)((*(h))+(skipbytes)))                                        \
  62.  
  63. #define SETFIRSTBYTESOFHANDLE(h,typ,data)                                \
  64.     SETBYTESOFHANDLE(h,typ,data,0)                                        \
  65.  
  66. #define FIRSTBYTESFROMHANDLE(h, typ)                                    \
  67.         GETBYTESOFHANDLE(h,typ,0)                                        \
  68.  
  69. const Boolean kFromTypeIsDesc = kODTrue;
  70. const Boolean kFromTypeIsPtr = kODFalse;
  71. const Boolean kIsSysHandler = kODTrue;
  72.  
  73. const ODSLong kODCountProcSwapValue = -1;
  74.  
  75. #define NULL_DESCRIPTOR_DEFINITION {typeNull, NULL}
  76.  
  77. extern "C" {
  78.  
  79. ODBoolean MissingParams(const AppleEvent* message);
  80. OSErr DecodeOrdinal(AEDesc ordData, long count, long* index,
  81.                     Boolean* allFlag, Boolean* zeroFlag);
  82. ODSLong GetSLongAttr(AppleEvent* ae, AEKeyword keyword);
  83. ODSLong GetSLongAttrOD(ODAppleEvent* ae, AEKeyword keyword);
  84.  
  85. // does an in-place coercion!
  86. void ThrowIfCantCoerce( AEDesc* data, DescType desiredType ) ;
  87. void ThrowIfNotAbsent( OSErr err ) ;
  88. ODSLong CountEmbeddedParts(Environment* ev, ODPart* prt);
  89.  
  90. void UpdateUserToken(Environment* ev, ODNameResolver* resolver,
  91.                         ODOSLToken* odToken, AEDesc* desc);
  92.     // Update the user token in odToken with data in desc. desc is disposed.
  93.  
  94. // do a double-dispose of AppleEvents that are copies of what might be
  95. // send-to-self events, since copies of these (eg. what you get when you
  96. // call ODDescToAEDesc) cannot be disposed with a single call to AEDisposeDesc.
  97. OSErr ODDisposeAppleEvent( AppleEvent* aevt );
  98.  
  99. struct StandardPartToken
  100. {
  101.     ODFrame* fFrame;
  102.     ODPart* fPart;
  103. };
  104. typedef struct StandardPartToken StandardPartToken, *StandardPartTokenPtr;
  105.  
  106. ODFrame* FrameFromStandardPartToken(AEDesc* token);
  107.  
  108. ODPart* PartFromStandardPartToken(AEDesc* token);
  109.  
  110. void    PartFrameFromStandardPartToken(AEDesc* token, ODPart** part, ODFrame** frame);
  111.  
  112. ODBoolean CanBeStandardPartToken( AEDesc* token );
  113.  
  114. OSErr CreateStandardPartToken( ODFrame* frame, ODPart* part, AEDesc* newToken );
  115.  
  116. ODFrame* GetDefaultRootFrame(Environment *ev, ODSession* session);
  117.  
  118. pascal ODBoolean ShouldHandleEvent(    ODPart*            part,
  119.                                     ODAppleEvent*    message,
  120.                                     ODAppleEvent*    reply,
  121.                                     ODSession*        session);
  122.  
  123. ODBoolean CompareDescs(const AEDesc *desc1, ODDescType operation, const AEDesc *desc2);
  124.  
  125. inline void MakeNULLDesc(AEDesc* desc)
  126. {
  127.     desc->descriptorType = typeNull;
  128.     desc->dataHandle = NULL;
  129. }    // MakeNULLDesc
  130.  
  131. }    // extern "C"
  132.  
  133. #endif // _SEUTILS_
  134.